<template>
  <div class="tempview-container" v-loading="loading">
    <div class="appo-header">
      <div>
        <el-button size="small" @click="importTemplate">导入模板</el-button>
        <el-button size="small" v-if="appoErrorListData.length===0" @click="appoCheckNumEidt">批量设置号源数</el-button>
        <!-- <el-button size="small" v-if="appoErrorListData.length===0" @click="appoSyncSet">同步时令号源参数</el-button> -->
        <el-button size="small" @click="appoStatusChange">批量修改状态</el-button>
        <el-button size="small" v-permission="['YJYY10002001']" @click="appoFiltersChange">批量加减限制条件</el-button>
        <el-divider direction="vertical" v-if="checkedAppoData.length>0 || isCheckedIds.length>0"></el-divider>
        <el-button size="small" type="danger" v-if="checkedAppoData.length>0 || isCheckedIds.length>0" @click="appoFscDel">删除</el-button>
        <!-- <el-button size="small" @click.stop="appoSetBatch">批量设置</el-button> -->
        <template v-if="APPOINTENTTEMPLATERECOMMEND">
          <el-divider direction="vertical"></el-divider>
          <el-date-picker
            size="small"
            v-model="checkRoomObj.recommendStartDate"
            type="date"
            :picker-options="startTimePickerOption"
            placeholder="开始日期"
            style="width: 130px;">
          </el-date-picker>
          <el-date-picker
            size="small"
            v-model="checkRoomObj.recommendEndDate"
            type="date"
            :picker-options="endTimePickerOption"
            placeholder="结束日期"
            style="width: 130px;">
          </el-date-picker>
          <el-button size="small" plain type="warning" @click="recommendContrast">历史预约平均数</el-button>
        </template>
      </div>
      <div style="text-align: right;" v-permission="'YJYY10002031001'">
        <el-button size="small" type="danger" v-if="appoErrorListData.length>0" @click="appoErrorEidt">出错号源（{{appoErrorListData.length}}）</el-button>
        <template v-else>
          <el-button size="small" type="plain" @click="tempSaveSend('regular')">同步更新</el-button>
          <el-divider direction="vertical"></el-divider>
          <el-button size="small" type="primary" @click="tempSend">保存</el-button>
        </template>
      </div>
    </div>
    <fullscheduleTips tips-type="template">
      <template v-if="appoErrorListData.length>0">请先处理完出错号源，才能进行保存提交</template>
      <div v-else slot="sendTips" v-permission="'YJYY10002031001'">请在设置或修改预约时段模板后保存,谢谢</div>
    </fullscheduleTips>
    <div class="appo-main">
      <!-- 号源设置界面 -->
      <!-- :del-send="true" 此参数是请求接口的删除号源editShow-->
      <fullschedule
        ref="fullschedule"
        :status-filter="statusFilter"
        :quick-temp-obj="quickTempObj"
        status-template="template"
        :hospital-code="checkRoomObj.HospitalCode"
        :row-height="84"
        :appo-repair="appoRepair"
        :checkbox-show="true"
        :is-copy="true"
        :edit-show="true"
        :all-ckb="true"
        @checkedIdChange="checkedIdChange"
        @addNewSchedule="addNewSchedule"
        @handleAppoInfo="handleAppoInfo"
        @handleAppoDel="handleAppoDel"
        @checkedAllChange="checkedAllChange"
        @copyInsertChange="copyInsertChange"
        @appoErrorListChange="appoErrorListChange"
        @closeTempDlg="closeTempDlg"
      ></fullschedule>
    </div>
    <scheduleTemplateFormSet
      v-if="isShowScheduleTemplateFormSet"
      ref="scheduleTemplateFormSet"
      temp-title="号源批量设置"
      template-type="template"
      @addScheduleTempSave="addScheduleTempSetSave"
    ></scheduleTemplateFormSet>
    <!-- 选择同步更新模板 -->
    <el-dialog
      title="同步更新"
      :visible.sync="dialogVisibleRegular"
      :destroy-on-close="true"
      width="400px"
      top="15%"
      :before-close="handleCloseRegular">
      <div>
        <el-form
          class="ky-form-inline ky-form-inline-sm"
          label-width="100px"
        >
          <el-form-item>
            <div slot="label">
              <span>起始日期</span>
              <el-tooltip class="item" effect="dark" content="提示：同步更新起始日期后预约时段号源将被当前模板同步更新！" placement="top-start">
                <i class="el-icon-info"></i>
              </el-tooltip>
            </div>
            <el-date-picker
              v-model="regularDate"
              type="date"
              placeholder="选择日期"
              :picker-options="regularPickerOptions">
            </el-date-picker>
          </el-form-item>
          <el-form-item label="">
            <el-checkbox v-model="regularIsPublish" style="margin-top: 10px;">更新并发布</el-checkbox>
          </el-form-item>
          <el-form-item v-if="regularEndOpen">
            <div slot="label">
              <span>截止日期</span>
              <el-tooltip class="item" effect="dark" content="提示：启用后开始日期至截止日期预约时段号源将被当前模板更新！" placement="top-start">
                <i class="el-icon-info"></i>
              </el-tooltip>
            </div>
            <el-date-picker
              v-model="regularEndDate"
              type="date"
              placeholder="选择日期"
              :picker-options="regularPickerOptions">
            </el-date-picker>
          </el-form-item>
          <el-form-item label="">
            <el-checkbox v-model="regularEndOpen" style="margin-top: 10px;">是否启用截止日期</el-checkbox>
          </el-form-item>
        </el-form>
        <el-divider></el-divider>
        <div class="tips"><span class="label">提示：</span>同步更新起始日期后的预约时段号源将被当前模板同步更新，新增号源为<span class="fc_blue">“计划排班”</span>状态，其它号源状态保留原来状态（如：设备故障、节假日、暂停预约）！
          <div v-show="regularIsPublish">勾选了<span class="fc_red">更新并发布</span>，则同步更新的时段号源状态为<span class="fc_blue">“计划排班”</span>的号源会被发布为<span class="fc_success">“正常预约”</span></div>
          <div :style="{ 'color': isAppointmentDates ? 'red' : 'black', 'font-size': isAppointmentDates ? '18px' : '14px' }"><br/>{{isAppointmentDates ? `注意：该机房号源已经在${isAppointmentDates}被约,已经修改为被约该日期的后一天时间` : ''}}</div>
        </div>
      </div>
      <span slot="footer" class="dialog-footer">
        <el-button size="small" @click="dialogVisibleRegular = false">取 消</el-button>
        <el-button size="small" :loading="loading" type="primary" @click="regularSend">确 定</el-button>
      </span>
    </el-dialog>
    <!-- 追加预约时段号源数 -->
    <appoNumEditDlg
      v-if="isopenapponumeditdlg"
      :isopenapponumeditdlg.sync="isopenapponumeditdlg"
      :sidebardata="sidebardata"
      @sureEditAppoNumEvent="appoCheckNumEidtSend"></appoNumEditDlg>
    <!-- 时段号源复制 -->
    <el-dialog
      title="时段号源复制导入"
      :visible.sync="appoCopyDialog"
      :destroy-on-close="true"
      width="500px"
      :close-on-click-modal="true"
      top="20%">
      <div>
        <el-form
          class="ky-form-inline ky-form-inline-sm"
          label-width="100px">
          <el-form-item label="导入目标星期" style="width: 100%;">
            <el-select v-model="appoCopyWeekInsert" clearable multiple style="width: 100%;">
              <el-option
                v-for="(item, index) in weekOptions"
                :key="index"
                :label="item"
                :value="item"
              >
              </el-option>
            </el-select>
          </el-form-item>
          <el-form-item label="复制目标星期" style="width: 100%;">
            <el-select v-model="appoCopyWeekTarget" clearable style="width: 100%;">
              <el-option
                v-for="(item, index) in weekOptions"
                :key="index"
                :label="item"
                :value="item"
              >
              </el-option>
            </el-select>
          </el-form-item>
          <el-form-item label="复制班次" style="width: 100%;">
            <el-select v-model="appoCopySidebar" clearable multiple style="width: 100%;">
              <el-option
                v-for="(item, index) in sidebardata"
                :key="index"
                :label="item.titleLab"
                :value="index"
              >
              </el-option>
            </el-select>
          </el-form-item>
        </el-form>
      </div>
      <span slot="footer" class="dialog-footer">
        <el-button size="small" @click="appoCopyDialog = false">取 消</el-button>
        <el-button size="small" type="primary" @click="appoCopySend">确 定</el-button>
      </span>
    </el-dialog>
    <!-- 模板导入 -->
    <template-fullschedule-dialog
      v-if="isShowTempFScheduleDialog"
      ref="templatefullscheduledialog"
      :all-checkbox="true"
      :appo-repair="appoRepair"
      @importDataContrast="importDataContrast"
      @closeTempDlg="closeTempDlg"
    ></template-fullschedule-dialog>
    <!-- 批量修改号源数据 -->
    <approSelectedView v-if="isShowApproSelectedView" ref="selectedViewRef" from="tempView"></approSelectedView>
    <!-- 时段号源时间段出错数据 -->
    <appoErrorList
      v-if="isShowAppoErrorList"
      ref="appoErrorList"
      @errorInsert="errorInsert"
      @errorChange="errorChange"
      error-type="template"
    ></appoErrorList>
    <appoStatusEdit
      v-if="isShowAppoStatusEdit"
      :as-edit-dialog.sync="asEditDialog"
      @appoStatusEidtCb="appoStatusEidtCb"
    >
      <!-- <div slot="tips" style="margin-top: 10px;">提示：修改预约时段会过滤掉<span style="color: #f00;">正常预约</span>状态的时段！</div> -->
    </appoStatusEdit>
    <!-- 号源编辑 -->
    <scheduleTemplateForm
      ref="scheduleTemplateForm"
      :is-open-dialog.sync="openTempateFormDialog"
      :temp-title.sync="tempTitle"
      :hospital-code="checkRoomObj.HospitalCode"
      template-type="template"
      tabel-type="2"
      @addScheduleTempSave="addScheduleTempSave"
      @editScheduleTempSave="editScheduleTempSave"
      @closeTempDlg="closeTempDlg"
    ></scheduleTemplateForm>
    <!-- 批量加减号源过滤条件 -->
    <appoFiltersAddSub
      :is-open-dialog.sync="openFiltersDialog"
      :hospital-code="checkRoomObj.HospitalCode"
      :dep="checkRoomObj.Dep"
      @handleBatchAddSubAppoFilters="handleBatchAddSubAppoFilters"
      @closeTempDlg="closeTempDlg"
    ></appoFiltersAddSub>
  </div>
</template>

<script>
// import bus from '@/api/bus'
import {
  getHospitalSetting,
  getAppTempModelex,
  deleteAppTemp
  // putCheckroomModelUpdatepublish
  // postappointmentlistdmbsyncappointment
} from '@/api/api'
import {
  depSalt,
  modalityTypeSalt,
  roomSalt,
  getAppointmentTempList,
  getAppointmentTempRecommendList,
  postAppTempbatchupdateSend,
  postappointmentlistdmbsyncappointmentSend,
  getHasAppointdmb
} from '@/api/room'
import fullschedule from '../components/fullschedule'
import fullscheduleTips from '../components/fullscheduleTips'
import scheduleTemplateForm from '../components/scheduleTemplateForm'
import scheduleTemplateFormSet from '../components/scheduleTemplateFormSet'
import templateFullscheduleDialog from '../components/templateFullscheduleDialog'
import appoStatusEdit from '../components/appoStatusEditTemp'
import appoErrorList from '../components/appoErrorList'
import approSelectedView from '../components/approSelectedView'
import appoNumEditDlg from '../components/appoNumEditDlg'
import appoFiltersAddSub from '../components/appoFiltersAddSub.vue'
import { dateFormatter } from '@/utils/validate'
import { getWeekStartEndDate, seasonCalCurrDate, flattenDeep, getCalTimeMinute } from '@/utils/schedule'
import { setSidebarDataTemp, getRoomTagCurr, isNull } from '@/utils/utils' // this.$utils
import { Options } from '@/utils/constant'
import bus from '@/api/bus'
export default {
  components: { approSelectedView, fullschedule, scheduleTemplateForm, scheduleTemplateFormSet, fullscheduleTips, templateFullscheduleDialog, appoErrorList, appoStatusEdit, appoNumEditDlg, appoFiltersAddSub },
  props: {
  },
  data() {
    return {
      openTempateFormDialog: false,
      openFiltersDialog: false,
      isShowAppoFiltersAddSub: false,
      isShowScheduleTemplateForm: false,
      isShowScheduleTemplateFormSet: false,
      isShowTempFScheduleDialog: false,
      isShowApproSelectedView: false,
      isShowAppoErrorList: false,
      isShowAppoStatusEdit: false,
      loading: false,
      appointmentData: [],
      appodataNow: [],
      isAppointmentDates: '', // 已经被预约出去的日期
      curDate: dateFormatter(new Date()),
      tempTitle: '', // 排班新增弹框标题
      appoRepair: this.$store.state.user.appoRepair, // 排班模板判断，是否现在时段间隔的时段占位数据
      // 机房，查询条件数据
      checkRoomObj: {
        StartDate: '',
        EndDate: '',
        HospitalCode: '',
        DepArea: '',
        Dep: '',
        ModalityType: '',
        CheckRoom: '',
        Week: '', // 星期几,多选,不传查所有
        Status: '', // 状态,启用、停用,默认启用
        AppointmentStatus: '', // 预约时段状态:暂停预约、节假日、正常预约、设备故障、计划排班；单选
        IsChangeSeason: true, // 是否根据夏令时冬令时不同，自动变更预约时段模板的开始时间和结束时间,默认false,根据模板排班时需传true
        // 历史号源数据对比
        recommendStartDate: dateFormatter(new Date().getTime() - 7 * 86400000), // 开始时间
        recommendEndDate: dateFormatter(new Date()) // 结束时间
      },

      // 排班
      step: '10',
      weekDateFull: [],
      sidebardata: [
        // {
        //   title: '上午班',
        //   start: '8:00',
        //   end: '12:00',
        //   barHeight: 0,
        //   timegather: []
        // }
      ],
      statusFilter: '暂停预约、节假日、正常预约、设备故障、计划排班',
      seasonTxt: '',
      // 快捷选择模板
      quickTempObj: null,
      qktVisible: false,

      // 新增排班选择数据
      week: '',
      checkClass: '',
      // 定时更新
      dialogVisibleRegular: false,
      regularDate: dateFormatter(new Date().getTime() + 8.64e7, false),
      regularEndDate: dateFormatter(new Date().getTime() + 8.64e7 + 8.64e7, false),
      regularEndOpen: false,
      regularIsPublish: false, // 是否更新发布
      regularPickerOptions: {
        disabledDate(time) {
          return time.getTime() < new Date()
        }
      },
      regularParams: null,
      checkedAppoData: [],
      // 追加预约时段号源数
      checkNumEditDialog: false,
      checkNumEditType: false,
      editFlagInLabel: '修改号源数',
      checkNumEditNum: 5,
      checkNumSidebarIndex: '',
      // 时段号源，复制
      appoCopyDialog: false,
      weekOptions: Options.weekOptions,
      appoCopySidebar: [],
      appoCopyWeekInsert: [],
      appoCopyWeekTarget: '',
      // 错误时间时段
      appoErrorListData: [],
      // 批量修改预约时段状态
      asEditDialog: false,
      isCheckedIds: [],
      isopenapponumeditdlg: false
    }
  },
  computed: {
    appConfig() {
      return this.$store.state.settings.appConfig
    },
    isCombineSelectBox() {
      return this.appConfig && this.appConfig.baseConfig && this.appConfig.baseConfig.isCombineSelectBox
    },
    APPOINTENTTEMPLATERECOMMEND() {
      return (this.appConfig && this.appConfig.baseConfig && this.appConfig.baseConfig.APPOINTENTTEMPLATERECOMMEND) || window.g.APPOINTENTTEMPLATERECOMMEND
    },
    startTimePickerOption() {
      const cobj = this.checkRoomObj
      return {
        disabledDate(time) {
          return time.getTime() > new Date(cobj.recommendEndDate).getTime()
        }
      }
    },
    endTimePickerOption() {
      const cobj = this.checkRoomObj
      return {
        disabledDate(time) {
          return time.getTime() < new Date(cobj.recommendStartDate).getTime()
        }
      }
    }
  },
  created() {
    console.log('created=>tempView')
    bus.$off('editTodaySchedule')
    bus.$on('editTodaySchedule', (data) => {
      // // console.log('111editTodaySchedule111', data)
      this.openMoreEidt(data)
    })
  },
  beforeDestroy() {
    console.log('beforeDestroy=>tempView')
  },
  methods: {
    checkedIdChange(data) {
      this.isCheckedIds = data
    },
    openMoreEidt(data) {
      this.isShowApproSelectedView = true
      this.$nextTick(() => {
        let weeks = ['星期一', '星期二', '星期三', '星期四', '星期五', '星期六', '星期日']
        if (data.type == 'edit_in') {
          let number = weeks.indexOf(data.row.week)
          const schedule = JSON.parse(JSON.stringify(this.$refs.fullschedule.scheduledata))
          this.$refs.selectedViewRef.open([schedule[number]] || [])
        } else {
          if (this.checkedAppoData.length == 1) {
            // // // console.log('weeks.indexOf(this.checkedAppoData[0].week)', weeks.indexOf(this.checkedAppoData[0].week))
            // // // console.log('index', data.index)
            let number = weeks.indexOf(this.checkedAppoData[0].week || data.row.week)
            const schedule = JSON.parse(JSON.stringify(this.$refs.fullschedule.scheduledata))
            this.$refs.selectedViewRef.open([schedule[number]] || [])
          } else {
            this.$message.warning('仅支持选择一天的号源进行修改')
          }
        }
      })
    },
    appoStatusEidtCb(status) {
      // // console.log('777888appoStatusEidtCb_status', status)
      this.asEditDialog = false
      this.$refs.fullschedule.resetAppoStatus(status, 'temp')
    },
    // 批量修改状态
    appoStatusChange() {
      this.isShowAppoStatusEdit = true
      if (this.isCheckedIds.length === 0) {
        this.$message.warning('请先勾选号源！')
        return
      }
      this.$nextTick(() => {
        this.asEditDialog = true
      })
    },
    // 批量加减过滤条件
    appoFiltersChange() {
      this.isShowAppoFiltersAddSub = true
      // // console.log('this.isCheckedIds.length', this.isCheckedIds.length)
      if (this.isCheckedIds.length === 0) {
        this.$message.warning('请先勾选号源！')
        return
      }
      // this.dep = this.checkRomeArr.Dep
      // console.log('this.dep', this.dep)
      this.$nextTick(() => {
        this.openFiltersDialog = true
      })
    },
    async recommendContrast() {
      this.loading = true
      const params = { ...this.checkRoomObj }
      params.StartDate = dateFormatter(params.recommendStartDate, false)
      params.EndDate = dateFormatter(params.recommendEndDate, false)
      // console.log('getAppointmentTempRecommendList_params', params)
      const appodata = await getAppointmentTempRecommendList(params) // /api/v1/appointmentcheckroomdmb/getrecommendlist
      console.log('getAppointmentTempRecommendList_appodata', appodata)
      this.loading = false
      // console.log('this.appodataNow', this.appodataNow)
      // 上次查询疑问，列表接口里也有历史号源平均数，还把平均数用来计算累加了，需确认是否正确
      this.$refs.fullschedule.appoPull(appodata)
    },
    async init(data, isRefresh) {
      console.log('init=>data', data)
      if (data.length === 4) {
        if (!isNull(getRoomTagCurr())) {
          data.push(getRoomTagCurr())
          // data.Modality = getRoomTagCurr().split('$#')[1]
          // data.CheckRoom = getRoomTagCurr().split('$#')[0]
        }
      }
      console.log('init=>data-new', data)
      if (JSON.stringify(this.checkRomeArr) === JSON.stringify(data) && !isRefresh) return false
      if (data && data.length > 0) {
        this.dlgClose()
        this.checkRomeArr = [...data]
        this.checkRoomObj.HospitalCode = data[0]
        this.checkRoomObj.DepArea = data[1]
        this.checkRoomObj.Dep = data[2]
        this.checkRoomObj.ModalityType = data[3]
        this.checkRoomObj.CheckRoom = data[4]
        this.checkRoomObj.AppointmentStatus = ''
        this.appoErrorListData = []
        this.loading = true
        await this.getWeekDateTimeFull()
        await this.getAppoTimeTemp()
        if (this.$refs.fullschedule) {
          await this.$refs.fullschedule.init({ date: this.curDate, sidebardata: this.sidebardata, seasonTxt: this.seasonTxt })
          this.getAppoTempList()
        }
        this.loading = false
      } else {
        this.$refs.fullschedule && this.$refs.fullschedule.init({ date: this.curDate, sidebardata: this.sidebardata, seasonTxt: this.seasonTxt })
      }
    },
    // 刷新当前模板
    async refresh() {
      this.loading = true
      await this.$refs.fullschedule.init({ date: this.curDate, sidebardata: this.sidebardata, seasonTxt: this.seasonTxt })
      this.getAppoTempList()
      this.loading = false
    },
    // 保存，排班模板数据批量提交
    tempSaveSend(type) {
      // const _isChanged = this.$refs.fullschedule.isChanged
      // // 判断是否更改了模板
      // if (!_isChanged && !type) {
      //   this.$message.info('提示：机房号源模板未修改！')
      //   return
      // }
      this.regularParams = null
      const params = {
        'hospitalCode': this.checkRoomObj.HospitalCode,
        'depArea': this.checkRoomObj.DepArea,
        'dep': this.checkRoomObj.Dep,
        'modalityType': this.checkRoomObj.ModalityType,
        'checkRoom': this.checkRoomObj.CheckRoom,
        'appointmentDate': this.checkRoomObj.StartDate,
        'batchUpdateAppointmentCheckRoomDmbs': []
      }
      // 获取排班模板组件内的 排班数据
      // 这里需要判断时间的正确性
      let errorTimeAppo = []
      const _scheduledata = JSON.parse(JSON.stringify(this.$refs.fullschedule.scheduledata))
      _scheduledata.forEach(sched => {
        sched.appointment.forEach(appo => {
          appo.forEach(item => {
            if (getCalTimeMinute(item.beginTime) >= getCalTimeMinute(item.endTime)) {
              errorTimeAppo.push(item)
            }
          })
          // ap.isAddBox == true 是指新增按钮，需要过滤掉
          let _ap = appo.filter(ap => !ap.isAddBox).map(item => {
            let _appo = { ...item }
            _appo.addNum = _appo.addNum * 1
            _appo.checkNum = _appo.checkNum * 1
            _appo.initialNum = _appo.initialNum * 1
            _appo.reserveNum = _appo.reserveNum * 1
            _appo.startNum = _appo.startNum * 1
            // 重新计算该条数据的班次(凌晨、早上、下午)
            // 1.获取到排班表竖向的时间轴数据
            // 。。。
            // if (item.beginTime)
            // 优化初始数据
            if (_appo.appointmentFilters.length == 0) {
              if (this.isCombineSelectBox) {
                let _appoFlrObj = {
                  parametersName: '外院预约',
                  parametersType: 'WYYY',
                  parametersValues: '非互联网预约'
                }
                _appo.appointmentFilters.push(_appoFlrObj)
                _appoFlrObj = {
                  parametersName: '临床预约',
                  parametersType: 'LCYY',
                  parametersValues: '非临床预约'
                }
                _appo.appointmentFilters.push(_appoFlrObj)
                _appoFlrObj = {
                  parametersName: '转诊预约',
                  parametersType: 'VIP',
                  parametersValues: '非转诊预约'
                }
                _appo.appointmentFilters.push(_appoFlrObj)
              }
            }
            return _appo
          })
          params.batchUpdateAppointmentCheckRoomDmbs = params.batchUpdateAppointmentCheckRoomDmbs.concat(_ap)
        })
      })
      // // console.log('检查这里的params.batchUpdateAppointmentCheckRoomDmbs是否正常', params)
      // 若时间有误，拦截提交
      if (errorTimeAppo.length) {
        let msg = []
        errorTimeAppo.forEach(item => {
          let m = `${item.week}=>${item.checkClass}=>${item.beginTime}~${item.endTime}`
          msg.push(m)
        })
        this.$confirm(`温馨提示：【${msg.join('、')}】时间存在异常，将会保存失败，请修正时间后再来保存！`, '提示', {
          confirmButtonText: '确定',
          cancelButtonText: '取消',
          type: 'warning'
        }).then((e) => {
          // // console.log('e', e)
          if (e == 'confirm') {
            // ..
          } else {
            // // console.log('cancel')
          }
        }).catch(() => {})
      } else {
        if (type === 'regular') {
          this.dialogVisibleRegular = true
          this.regularParams = params
          this.regularIsPublish = false
          this.regularEndOpen = false
          console.log('this.regularParams', this.regularParams)
          // 调用接口
          const modality = this.checkRoomObj.ModalityType.split('-')
          // console.log('checkRoom', checkRoom)
          let p = {
            HospitalCode: this.regularParams.hospitalCode,
            DepArea: this.regularParams.depArea,
            Dep: this.regularParams.dep,
            ModalityType: this.regularParams.modalityType,
            Modality: modality[2],
            CheckRoom: this.regularParams.checkRoom
          }
          // const regularParams = JSON.parse(this.regularParams)
          console.log('p', p)
          getHasAppointdmb(p).then(res => {
            const appointedDays = res
            if (appointedDays.length > 0) {
              this.isAppointmentDates = appointedDays[0].appointmentDate
              // console.error('111', new Date(this.isAppointmentDates).getDate(), new Date().getDate())
              this.regularDate = new Date(this.isAppointmentDates).getDate() === new Date().getDate() ? this.regularDate : dateFormatter(new Date(this.isAppointmentDates).getTime() + 8.64e7, false)
              this.isAppointmentDates = new Date(this.isAppointmentDates).getDate() === new Date().getDate() ? '' : dateFormatter(new Date(this.isAppointmentDates), false)
              this.regularEndDate = dateFormatter(new Date(this.regularDate).getTime() + 8.64e7, false)
            }
            // appointedDays.forEach(element => {
            // })

            // console.log('gethasappointdmb=>res', res)
          })
        } else {
          this.loading = true
          postAppTempbatchupdateSend(params).then(res => {
            this.loading = false
            if (res && res.code === 10000) {
              this.checkedAppoData = []
              this.$message.success(res.message)
              this.getAppoTempList()
            }
          })
        }
      }
    },
    // 保存
    async tempSend() {
      if (this.appoErrorListData.length > 0) {
        this.$message.warning('预约号源时段错误的数据须先处理完！')
        return
      }
      // 模板数据提交
      this.tempSaveSend()
    },
    // 定时更新，日期选择
    handleCloseRegular() {
      this.dialogVisibleRegular = false
    },
    // 定时更新提交
    regularSend() {
      if (!this.regularParams) return
      const regularParams = typeof this.regularParams == 'string' ? JSON.parse(this.regularParams) : this.regularParams
      const params = {
        selectDate: dateFormatter(new Date(this.regularDate), false),
        hospitalCode: regularParams.hospitalCode,
        depArea: regularParams.depArea,
        dep: regularParams.dep,
        modalityType: regularParams.modalityType,
        checkRoom: regularParams.checkRoom,
        isPublish: this.regularIsPublish,
        syncAppointmentCheckRoomDmbs: regularParams.batchUpdateAppointmentCheckRoomDmbs
      }
      let contentInfo = `${params.selectDate} 后预约时段号源将被当前模板同步更新！, 是否继续?`
      if (this.regularEndOpen) {
        const startDate = new Date(this.regularDate)
        const endDate = new Date(this.regularEndDate)
        params.endDate = dateFormatter(new Date(this.regularEndDate), false)
        if (startDate > endDate) {
          this.$message.warning('开始日期不得大于截止日期，请修改后重试')
          return
        }
        contentInfo = `${params.selectDate} 至${params.endDate}预约时段号源将被当前模板同步更新！, 是否继续?`
      }
      console.log('params', params)
      // params.selectDate = this.regularDate
      this.$confirm(contentInfo, '提示', {
        confirmButtonText: '确定',
        cancelButtonText: '取消',
        type: 'warning'
      }).then(() => {
        this.loading = true
        postappointmentlistdmbsyncappointmentSend(params).then(res => {
          this.loading = false
          if (res && res.code === 10000) {
            this.$message.success(res.message)
            this.dialogVisibleRegular = false
          }
        })
      }).catch(() => {})
    },
    // 查询，获取排班模板数据
    async getAppoTempList() {
      this.loading = true
      // console.log('getAppoTempList=>this.checkRoomObj', this.checkRoomObj)
      const appodata = await getAppointmentTempList(this.checkRoomObj)
      this.appodataNow = appodata
      // console.log('getAppointmentTempList_appodata', appodata)
      this.loading = false
      this.$nextTick(() => {
        this.$refs.fullschedule.appoPull(appodata, null, true, true)
      }, 200)
    },
    // 获取排班一周的完整时间数组
    getWeekDateTimeFull() {
      return new Promise(async resolve => {
        this.weekDateFull = await getWeekStartEndDate(this.curDate)
        if (this.weekDateFull.length > 0) {
          this.checkRoomObj.StartDate = this.weekDateFull[0]
          this.checkRoomObj.EndDate = this.weekDateFull[this.weekDateFull.length - 1]
        }
        resolve()
      })
    },
    // 导入模板
    importTemplate() {
      this.isShowTempFScheduleDialog = true
      this.$nextTick(() => {
        this.$refs.templatefullscheduledialog.init(this.checkRomeArr, this.curDate)
      })
    },
    handleBatchAddSubAppoFilters(ruleParams) {
      console.log('handleBatchAddSubAppoFilters')
      this.$refs.fullschedule.batchAddSubAppoFilters(ruleParams)
    },
    closeTempDlg() {
      this.isShowTempFScheduleDialog = false
      this.isShowScheduleTemplateForm = false
      this.isShowAppoFiltersAddSub = false
      this.openFiltersDialog = false
      this.openTempateFormDialog = false
      console.log('closeTempDlg=>this.openFiltersDialog', this.openFiltersDialog)
    },
    // 导入数据对比判断、抛出提示
    async importDataContrast(scheData) {
      console.log('importDataContrast=>scheData', scheData)
      // 暂停预约、节假日、正常预约、设备故障、计划排班
      // 1、对导入数据、原有数据(appointment)进行平铺处理 [[],[]] > [{},{}]
      // 2、平铺处理的导入数据，初始化处理，医院、科室、状态等
      // // 3、原有数据，与导入数据的同日期对比，计算存在时段时间区间交集的数据个数、及交集的数据且状态为 正常预约 的数据个数
      // // 4、根据计算出来的交集数据个数、交集且状态为 ‘正常预约’ 的数据个数，做出提示

      // 获取排班组件内的 排班数据
      const { importScheduleData, isWeek, isTemp } = scheData
      const _scheduledata = JSON.parse(JSON.stringify(this.$refs.fullschedule.scheduledata))
      const IScheData = importScheduleData
      let roomObj = JSON.parse(JSON.stringify(this.checkRoomObj))
      let _scheAppoData = [] // 存放
      let _importScheAppoData = []
      this.appoErrorListData = []
      IScheData.forEach(iSche => {
        const iScheWeek = iSche.week
        // 获取当前日期是否可以编辑
        // const _weekIndex = _scheduledata.findIndex(sched => sched.week === iScheWeek)
        // const _disable = _weekIndex >= 0 ? _scheduledata[_weekIndex].disable : false
        // if (_disable) {
        //   // 判断当前日期是否为今天之前的日期，今天日期之前的时间不可以修改预约时段
        //   return
        // }
        let iScheAppoArr = iSche.appointment
        iScheAppoArr = flattenDeep(iScheAppoArr)
        // 初始化时段数据
        iScheAppoArr.forEach(iScheAppo => {
          iScheAppo.hospitalCode = roomObj.HospitalCode
          iScheAppo.depArea = roomObj.DepArea
          iScheAppo.dep = roomObj.Dep.indexOf(depSalt) >= 0 ? roomObj.Dep.replace(depSalt, '') : roomObj.Dep
          iScheAppo.modality = roomObj.ModalityType.indexOf(modalityTypeSalt) >= 0 ? roomObj.ModalityType.replace(modalityTypeSalt, '') : roomObj.ModalityType
          iScheAppo.checkRoom = roomObj.CheckRoom.indexOf(roomSalt) >= 0 ? roomObj.CheckRoom.replace(roomSalt, '') : roomObj.CheckRoom
          // iScheAppo.appointmentStatus = ''
          iScheAppo.status = '启用'
          iScheAppo.remark2 = ''
          iScheAppo.id = 0
        })
        // console.log(iScheAppoArr)
        _importScheAppoData.push(flattenDeep(iScheAppoArr))
        _scheduledata.forEach(sche => {
          if (sche.week === iScheWeek) {
            // 相同的星期
            // const appoString = JSON.stringify(sche.appointment)
            let scheAppoArr = sche.appointment.map(ia => ia.filter(a => !a.isAddBox))
            _scheAppoData.push(flattenDeep(scheAppoArr))
          }
        })
      })
      let lapAppo = 0
      if (_scheAppoData.length === 0) {
        // 预约排班视图界面当前选择的模板时间没有数据
      } else {
        const ISLen = _importScheAppoData.length
        for (let i = 0; i < ISLen; i++) {
          const ISDayAppos = _importScheAppoData[i]
          const ISDLen = ISDayAppos.length
          for (let j = 0; j < ISDLen; j++) {
            const ISDAppo = ISDayAppos[j]
            let IminTime = ISDAppo.beginTime
            let ImaxTime = ISDAppo.endTime
            let ImaxMin = ImaxTime.split(':')[0] * 60 + ImaxTime.split(':')[1] * 1
            let IminMin = IminTime.split(':')[0] * 60 + IminTime.split(':')[1] * 1
            _scheAppoData[i].forEach(appo => {
              let minTime = appo.beginTime
              let maxTime = appo.endTime
              let maxMin = maxTime.split(':')[0] * 60 + maxTime.split(':')[1] * 1
              let minMin = minTime.split(':')[0] * 60 + minTime.split(':')[1] * 1
              // 判断时段区间的交集情况
              if (!(ImaxMin <= minMin && IminMin < minMin) && !(ImaxMin > maxMin && IminMin >= maxMin)) {
                lapAppo++
              }
            })
          }
        }
      }
      // // // console.log('lapAppo:====', lapAppo)
      // // // console.log('_scheAppoData', _scheAppoData)
      console.log('_importScheAppoData', _importScheAppoData)
      if (lapAppo > 0) {
        this.$confirm('导入号源时段区间已存在号源，是否覆盖？', '提示', {
          confirmButtonText: '确定',
          cancelButtonText: '取消',
          type: 'warning'
        }).then(async () => {
          await this.$refs.fullschedule.appoImport(_importScheAppoData, isWeek, isTemp)
          this.isShowTempFScheduleDialog && this.$refs.templatefullscheduledialog.closeTempDlg()
        }).catch(() => {})
        return false
      }
      await this.$refs.fullschedule.appoImport(_importScheAppoData, isWeek, isTemp)
      this.isShowTempFScheduleDialog && this.$refs.templatefullscheduledialog.closeTempDlg()
    },

    // 周-变化
    weekChange(data) {
      this.appoErrorListData = []
      // 初始预约排班
      this.$refs.fullschedule.init({ date: data, sidebardata: this.sidebardata, seasonTxt: this.seasonTxt })
    },
    // 快捷模板选择监听
    quickTempChange(quickTempObj) {
      this.quickTempObj = quickTempObj ? { ...quickTempObj } : null
    },
    // 新增排班模板
    addNewSchedule(data) {
      this.isShowScheduleTemplateForm = true
      this.openTempateFormDialog = true
      console.log('新增号源', data)
      const bTime = data.timeSel.split('-')[0]
      const eTime = data.timeSel.split('-')[1]
      const minMaxNum = this.$refs.fullschedule.getInitialMinMaxNum(bTime, eTime)
      this.week = data.week
      this.checkClass = data.checkClass
      this.tempTitle = '新增机房号源'
      const stfData = {
        time: data.time,
        startNum: data.startNum,
        appoInfo: null,
        step: this.step,
        room: this.checkRomeArr,
        timeSel: data.timeSel,
        minMaxNum
      }
      // // console.log('新增排班模板', stfData)
      this.$nextTick(() => {
        this.$refs.scheduleTemplateForm.init(stfData)
      })
    },
    // 查看、编辑预约排班信息
    async handleAppoInfo(data) {
      this.isShowScheduleTemplateForm = true
      this.openTempateFormDialog = true
      // // console.log('查看、编辑预约排班信息', data)
      const bTime = data.appoInfo.beginTime
      const eTime = data.appoInfo.endTime
      const minMaxNum = this.$refs.fullschedule.getInitialMinMaxNum(bTime, eTime)
      this.tempTitle = '编辑机房号源'
      let appoTempInfo = { ...data }
      if (data.id) {
        appoTempInfo = await this.getAppTempModelex(data)
      }
      let b = false
      if (data.isCheckedIds.length > 0) {
        b = true
      }
      const stfData = {
        time: appoTempInfo.time,
        startNum: data.startNum,
        appoInfo: appoTempInfo.appoInfo,
        room: this.checkRomeArr,
        timeSel: data.timeSel,
        step: this.step,
        minMaxNum,
        checkMore: b
      }
      // // console.log('stfData', stfData)
      this.$nextTick(() => {
        this.$refs.scheduleTemplateForm.init(stfData)
      })
    },
    async addScheduleTempSave(data) {
      console.log('addScheduleTempSave=>新增模板')
      // // console.log('++++++++++++++++++++++++++++++++++++++++addScheduleTempSave:====', data)
      const appo = {
        addNum: data.addNum,
        beginTime: data.beginTime,
        checkNum: data.checkNum,
        endTime: data.endTime,
        initialNum: data.initialNum,
        reserveNum: data.reserveNum,
        appointmentFilters: [...data.appointmentFilters],
        checkClass: this.checkClass,
        checkRoom: this.checkRoomObj.CheckRoom,
        dep: this.checkRoomObj.Dep,
        depArea: this.checkRoomObj.DepArea,
        hospitalCode: this.checkRoomObj.HospitalCode,
        modality: this.checkRoomObj.Modality,
        status: data.status ? data.status : '启用',
        week: this.week
      }
      // const resAdd = await addAppTempSend(appo)
      // // console.log(resAdd)
      this.$refs.fullschedule.addNew(appo, true)
    },
    async addScheduleTempSetSave(dataAll) {
      // // console.log('++++++++++++++++++++addScheduleTempSetSave++++++++++++++++++++')
      const appoData = []
      dataAll.forEach(async appoDay => {
        const appoD = []
        appoDay.forEach(item => {
          const appo = {
            addNum: item.addNum,
            beginTime: item.beginTime,
            checkNum: item.checkNum,
            endTime: item.endTime,
            initialNum: item.initialNum,
            reserveNum: item.reserveNum,
            appointmentFilters: [...item.appointmentFilters],
            checkClass: this.checkClass,
            checkRoom: this.checkRoomObj.CheckRoom,
            dep: this.checkRoomObj.Dep,
            depArea: this.checkRoomObj.DepArea,
            hospitalCode: this.checkRoomObj.HospitalCode,
            modality: this.checkRoomObj.Modality,
            status: item.status ? item.status : '启用',
            week: item.week
          }
          appoD.push(appo)
        })
        appoData.push(appoD)
      })
      for (let i = 0; i < appoData.length; i++) {
        await this.$refs.fullschedule.appoImport(JSON.parse(JSON.stringify([appoData[i]])), false)
      }
      // // console.log('addScheduleTempSetSave appoData', appoData)
    },
    async editScheduleTempSave(data) {
      console.log('号源模板编辑保存')
      // // console.log('++++++++++++++++++++editScheduleTempSave:====', data)
      // const appo = {
      //   addNum: data.addNum,
      //   beginTime: data.beginTime,
      //   checkNum: data.checkNum,
      //   endTime: data.endTime,
      //   initialNum: data.initialNum,
      //   reserveNum: data.reserveNum,
      //   appointmentFilters: data.appointmentFilters,
      //   checkClass: this.checkClass,
      //   checkRoom: this.checkRoomObj.CheckRoom,
      //   dep: this.checkRoomObj.Dep,
      //   depArea: this.checkRoomObj.DepArea,
      //   hospitalCode: this.checkRoomObj.HospitalCode,
      //   id: data.id,
      //   modality: this.checkRoomObj.Modality,
      //   status: '启用',
      //   week: this.week
      // }
      // if (data.id) {
      //   await editAppTempSend(data)
      //   this.getAppoTempList()
      // } else {
      //   }
      this.$refs.fullschedule.editUpdate(data)
    },

    // 获取时段数据,计算时段
    getAppoTimeTemp() {
      return new Promise(async resolve => {
        const depArr = (this.checkRoomObj.Dep && this.checkRoomObj.Dep.indexOf('-') > -1 && this.checkRoomObj.Dep.split('-')) || ''
        let dep = (depArr && depArr.length && depArr[depArr.length - 1]) || ''
        if (this.checkRoomObj.Dep && this.checkRoomObj.Dep.indexOf('-') == -1) {
          dep = this.checkRoomObj.Dep
        }
        const param = {
          HospitalCode: this.checkRoomObj.HospitalCode,
          depArea: this.checkRoomObj.DepArea,
          dep
        }
        await getHospitalSetting(param).then(async res => {
          if (res && res.code === 10000) {
            // 获取模板的时间轴
            const season = await seasonCalCurrDate(res.content.seasonSettings, this.weekDateFull[0], true, false, true)
            this.seasonTxt = season.title
            this.sidebardata = season.sidebardata
            console.log('getAppoTimeTemp=>getHospitalSetting=>setSidebarData', this.sidebardata)
            setSidebarDataTemp(JSON.stringify(season.sidebardata))
          }
        })
        resolve()
      })
    },
    // 获取时段数据
    getAppTempModelex(appoInfo) {
      return new Promise(async resolve => {
        const param = {
          Id: appoInfo.id
        }
        await getAppTempModelex(param).then(async res => {
          if (res && res.code === 10000) {
            resolve(res)
          }
        })
      })
    },
    // 删除排班时段数据
    handleAppoDel(appoInfo) {
      // console.log(appoInfo)
      const params = {
        Id: appoInfo.id,
        HospitalCode: this.checkRoomObj.HospitalCode
      }
      this.$confirm('删除模板号源, 是否继续?', '提示', {
        confirmButtonText: '确定',
        cancelButtonText: '取消',
        type: 'warning'
      }).then(() => {
        this.loading = true
        deleteAppTemp(params).then(res => {
          this.loading = false
          if (res && res.code === 10000) {
            // bus.$emit('delAppoSuccess')
            this.$refs.fullschedule.appoDelSuccessCb()
          }
        })
      }).catch(() => {})
    },
    // 监听排班组件日全选事件
    checkedAllChange() {
      let scheduledata = []
      const schedule = JSON.parse(JSON.stringify(this.$refs.fullschedule.scheduledata))
      schedule.forEach(item => {
        if (item.checkedAll) {
          scheduledata.push(item)
        }
      })
      this.checkedAppoData = scheduledata
      // // console.log(scheduledata)
    },
    // 批量设置号源数
    appoCheckNumEidt() {
      if (this.isCheckedIds.length === 0) {
        this.$message.warning('请先勾选号源！')
        return
      }
      this.isopenapponumeditdlg = true
    },
    async appoCheckNumEidtSend(res) {
      console.log('appoCheckNumEidtSend=>res', res)
      if (!res.checkNumAddNum) {
        this.$message.warning('数量不能为空！')
        return
      } else if (res.checkNumAddNum < 0) {
        this.$message.warning('数量不能小于0！')
        return
      }
      await this.$refs.fullschedule.setDateNumUpdate(res.checkNumAddNum, res.checkNumSidebarIndex, res.checkNumEditType, res.updateField)
      this.isopenapponumeditdlg = false
    },
    // 同步时令设置时段参数
    appoSyncSet() {
      this.$confirm('起始号码根据时令设置的班次参数同步, 是否继续?', '提示', {
        confirmButtonText: '确定',
        cancelButtonText: '取消',
        type: 'warning'
      }).then(() => {
        // // console.log('确认同步！')
        this.$refs.fullschedule.appoSyncSet()
      }).catch(() => {})
    },
    // 删除选中的日期所有号源
    appoFscDel() {
      this.$refs.fullschedule.appoDelDay()
    },
    // 复制 提交
    async appoCopySend() {
      if (!this.appoCopyWeekTarget) {
        this.$message.warning('请选择复制目标星期！')
        return false
      } else if (this.appoCopyWeekInsert.length === 0) {
        this.$message.warning('请选择导入目标星期！')
        return false
      }

      /**
       * 1、获取复制目标星期的数据（判断是否选择班次，如果没有整天复制导入）。
       * 2、把获取到的目标数据id 设为 0
       * 3、获取导入目标星期的数据
       */

      const _scheduledata = JSON.parse(JSON.stringify(this.$refs.fullschedule.scheduledata))
      // console.log('_scheduledata', _scheduledata)
      // 获取复制目标星期的数据
      let copyTargetSchedule = _scheduledata.find(item => item.week === this.appoCopyWeekTarget)
      // console.log('copyTargetSchedule', JSON.stringify(copyTargetSchedule))
      copyTargetSchedule = JSON.parse(JSON.stringify(copyTargetSchedule))
      let tAppo = []
      // console.log('this.appoCopySidebar', this.appoCopySidebar)
      if (this.appoCopySidebar.length === 0) {
        tAppo = copyTargetSchedule.appointment.map(ia => ia.filter(a => !a.isAddBox))
      } else {
        let copyTargetAppointment = copyTargetSchedule.appointment.map(ia => ia.filter(a => !a.isAddBox))
        // console.log('copyTargetAppointment', JSON.stringify(copyTargetAppointment))
        copyTargetAppointment.forEach((appos, index) => {
          // console.log('index', index)
          // 把上午班或下午班加到tAppo数组里
          if (this.appoCopySidebar.indexOf(index) >= 0) {
            tAppo.push(appos)
          } else {
            tAppo.push([])
          }
        })
      }
      // 把复制的数据id设置为0
      tAppo.forEach(appos => {
        if (appos.length > 0) {
          appos.forEach(item => {
            item.id = 0
          })
        }
      })
      // // console.log('tAppo === ', tAppo)
      let tAppoFlat = flattenDeep(tAppo)
      if (tAppoFlat.length === 0) {
        this.$message.warning('选择的导入目标星期无时段号源数据！')
        return false
      }
      let insertAppoArr = [] // 需要导入的数据数组，[每一周的号源数据数组]
      _scheduledata.forEach(sche => {
        // // console.log(this.appoCopyWeekInsert.includes(sche.week))
        if (this.appoCopyWeekInsert.includes(sche.week)) {
          // 把复制数据星期几设置为导入星期几
          tAppo.forEach(appos => {
            if (appos.length > 0) {
              appos.forEach(item => {
                item.week = sche.week
              })
            }
          })
          if (this.appoCopySidebar.length === 0) {
            sche.appointment = JSON.parse(JSON.stringify(tAppo))
          } else {
            this.appoCopySidebar.forEach(sideIndex => {
              sche.appointment[sideIndex] = JSON.parse(JSON.stringify(tAppo[sideIndex]))
            })
          }
          insertAppoArr.push(flattenDeep(sche.appointment))
        }
        //  else {
        //   insertAppoArr.push([])
        // }
      })
      // console.log('copy insertAppoArr === ', insertAppoArr)
      await this.$refs.fullschedule.appoImport(insertAppoArr)
      this.appoCopyDialog = false
    },
    // 批量设置号源
    appoSetBatch() {
      this.isShowScheduleTemplateFormSet = true
      const stfData = {
        room: this.checkRomeArr
      }
      this.$nextTick(() => {
        this.$refs.scheduleTemplateFormSet.init(stfData)
      })
    },
    // 复制导入选择弹框
    copyInsertChange(data) {
      this.appoCopyDialog = true
      const { index } = data
      // this.appoCopyWeekInsert = [this.weekOptions[index]]
      this.appoCopyWeekTarget = this.weekOptions[index]
    },
    // 关闭模态框
    dlgClose() {
      this.isShowScheduleTemplateForm && this.$refs.scheduleTemplateForm.close()
      this.isShowScheduleTemplateFormSet && this.$refs.scheduleTemplateFormSet.close()
    },
    // 号源出错显示
    appoErrorEidt() {
      this.isShowAppoErrorList = true
      this.$nextTick(() => {
        this.$refs.appoErrorList.show()
      })
    },
    errorChange(data) {
      this.appoErrorListData = [...data]
      this.$refs.fullschedule.isChanged = true
    },
    // 打开显示时间出错的时段号源列表
    appoErrorListChange(data) {
      this.appoErrorListData = data ? [...data] : this.appoErrorListData
      this.$refs.appoErrorList.init(JSON.parse(JSON.stringify(this.appoErrorListData)))
    },
    // 出错时段号源，处理完后回传周模板
    errorInsert(data) {
      // console.log(data)
      this.$refs.fullschedule.insertError(data)
    }
  }
}
</script>

<style lang="scss" scoped>
.appo-header{
  display: flex;
  justify-content: space-between;
  align-items: center;
}
.item-line-36 /deep/ .el-form-item__content{
  line-height: 36px;
}

.releaseauto{
  margin:0 20px;
  cursor: pointer;
  font-size: 14px;
  .dot{
    display: inline-block;
    width: 8px;
    height: 8px;
    border-radius: 50%;
    margin-right: 8px;
    background-color: rgb(67, 207, 32);
  }
}
.autotips{
  font-size: 16px;
  color: #666;
  margin-left: 4px;
  vertical-align: -2px;
}
.tips{
  font-size: 12px;
  color: #666;
  line-height: 1.6em;
  .label{
    color: #333;
  }
}
</style>
